<%--
 *  File:    DistributortenderAreaSummary.jsp
 *  @Author: Hilldao
 *  Date:    2010/07/31
 *
 *  Copyright (C) 2000 - 2001 Oval Technologies, Inc.
 *  All rights reserved.
 *
 *  This software is the confidential and proprietary information of Oval
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>


<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>     
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>
<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>


<%
  //init param
  Category cat = Category.getInstance("jsp.DistributortenderAreaSummary");
   
  String strModuleName = "DMS";
  String strTableName = "v_distributortenderarea";
  Integer sourceorgid = new Integer(-1);
  String contextPath = request.getContextPath();
  String isView = request.getParameter("isview");
  if(isView == null && session.getAttribute("isview") != null){
  	isView = session.getAttribute("isview").toString();
  }
%>



<%
  //get userinfo
  HashMap CurUserInfo = (HashMap)session.getAttribute("userinfo");

%>
<% //--------------------------------------  include files list --%>
<%@ include file="/inc/FrmDefault.inc" %>
<%@ include file="/inc/PageDefault.inc" %>
<%@ include file="/inc/LocationDefault.inc" %>

<html>
<iframe name="summaryfrm" scrolling="no" frameborder="0"
	style="position:absolute; top:0px; left:0px; display:none;border:#909eff 1px solid;"></iframe>
<head>
<head>
<title>DistributortenderAreaSummary</title>
<PageFlow:CheckPageFlow pageName="p_disarea"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="../../css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="../js/FuncLib.js"></script>
<script language="JavaScript" src="../../js/ScriptLib.js"></script>
<%@ include file="../../inc/SummaryDivision.inc" %>
<iframe name="reloadHandler" style="display:none" ></iframe>
<%

  //OvalCustomTable table = new OvalCustomTable(strLanguageCode);
  //OvalCustomColumn column = new OvalCustomColumn(strLanguageCode);


  Vector visitprocessprodinfo = (Vector)pageContext.getAttribute("visitprocessprodinfo");
  if(visitprocessprodinfo == null)
  {
    visitprocessprodinfo = new Vector();
  }

    HashMap orgInfo = (HashMap)pageContext.getAttribute("orginfo");
	if (orgInfo == null) orgInfo = new HashMap();

    boolean ispharmacy = false;

    Integer globalPCCode =  (Integer)orgInfo.get("globalpccode");

	
	Integer zmylcustomtype =  (Integer)orgInfo.get("zmylcustomtype");


	if(globalPCCode == null) globalPCCode = new Integer("-1");
    if(zmylcustomtype == null) globalPCCode = new Integer("-1");
	
	Integer distributortenderid =  (Integer)pageContext.getAttribute("distributortenderid");
	

%>
<script>

function page_add()
{

  //if(!checkALLElems(document.getElementById("newdetail"))) return;
   <%if(ispharmacy){%>
  if(isEmpty(document.resoninfoform.employeeid.value)&&isEmpty(document.resoninfoform.hospitalid.value))
   { alert("<%= message.getMessageDesc("P_Please_Select_Employee_Or_Hospital") %>");
      return;
    }
  <%}%>
    document.resoninfoform.actionname.value = "add";
	isRunning = true;
    document.resoninfoform.target = "_self";
	document.resoninfoform.submit();
}
function page_delete() {

  if (checkedNumber(document.resoninfoform.deleteids) == 0) {
     alert("<%= message.getMessageDesc("PLEASE_SELECT") %>");
    return;
  }

  document.resoninfoform.actionname.value = "delete";
	isRunning = true;
    document.resoninfoform.target = "_self";
	document.resoninfoform.submit();
}
function checkedNumber(ids) {
  if(ids == null)
    return 0;
  if(ids.length == null) {
    if(ids.checked)
      return 1;
    else
      return 0;
  }
  var count = 0;
  for(var i = 0; i < ids.length; i ++) {
    if(ids[i].checked)
      count ++;
  }
  return count;
}

function page_summary(actionvalue,orderbyname)
{
  
  var editform = summaryPrepare(resoninfoform,actionvalue,orderbyname);
  editform.action = "DistributortenderAreaSummary.jsp?<%= OvalTools.randomURL() %>";
  editform.target = "_self";
  isRunning = true;
  editform.submit();
}

var popwindow;
function page_selectArea(){
   
	var url = "<%=contextPath%>/devlop/distributortender/DistributortenderAreaSelect.jsp?distributortenderid="+document.resoninfoform.distributortenderid.value+"&<%= OvalTools.randomURL()%>";
	var windowAttribute = "height=200, width=600,top=100,left=100, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, status=yes";
  	if(popwindow!=null) popwindow.close();
  	popwindow = window.open(url,null,windowAttribute);
}

function page_setDis(id,value,name){
	var frm = document.resoninfoform;
	frm.dictionaryids.value = id;
	frm.shortvalue.value = value;
	frm.shortname.value = name;
}



</script>

</head>
<body>
<table width="100%" cellspacing="0">
 <form name="resoninfoform" method="post" action="../../Dispatcher"  target="_parent">
   <input type="hidden" name="pagename" value="p_disarea">
	 <input type="hidden" name="actionname">
	 <input type="hidden" name="languagecode" value="<%= strLanguageCode %>">

<custom:hidden property="productgroupid"/>
     <custom:hidden property="parentorgid"/>
     <custom:hidden property="datacategory"/>
     <custom:hidden property="globalpccode"/>
    <custom:hidden property="objecttype"   />
    <input type="hidden" name="distributortenderid" value="<%=distributortenderid %>">
   <input type="hidden" name="na" value=" ">

<table width="100%" cellspacing="0">
  <% //--------------------------------------  page location --%>
	<%@ include file="../../inc/PageLocation.inc" %>
</table>
<table width="100%" cellspacing="0" border="0" cellpadding="0">

  <tr>
      <td class="summary_top">
          <table width="100%" border="0" cellspacing="0">
      	   <%@ include file="/inc/SummarySearch.inc" %>
          </table>
      </td>
  </tr>

  <tr>
    <td>
      <table width="100%" border="1" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" align="center">
		<tr class="deepblue-left">
		      <td class="title_center" width="20">&nbsp;</td>
		     <td class="title_center" width="*"><%=label.getLabelName("L_Region") +label.getLabelName("L_Value")%></td>
		      <td class="title_center" width="60"><%=label.getLabelName("L_Region") +label.getLabelName("L_ItemName1")%></td>
		</tr>


        <%
             int j = 0;
             String strClassType = new String();
             Integer nDefaultId = new Integer(-1);
             boolean bHasChecked = false;
          %>
          <logic:iterate id="reasoninfo" collection="<%= visitprocessprodinfo %>">

         <%
            HashMap resoninfoMap = (HashMap)pageContext.getAttribute("reasoninfo");

            String strIsDisabled = new String("");
            String strIsChecked = new String("");

            if(j%2 == 1){
              strClassType = "td-listrom";
            }else{
              strClassType = "";
            }
           if(!bHasChecked)
            {
              strIsChecked = "Checked";
              bHasChecked = true;
              nDefaultId = (Integer)(resoninfoMap.get("distributortenderareaid"));
            }
            j++;
          %>

		<tr>
              
            <td width="5%">
              <input type="checkbox" name="deleteids" value="<%=JspHelper.filterNull( resoninfoMap.get("distributortenderareaid"))%>" class="checkbox">
            </td>
             <td>&nbsp;<custom:write   property="value" name="reasoninfo"/></td>
             <td>&nbsp;<custom:write   property="valuename" name="reasoninfo"/></td>
          </tr>
          </logic:iterate>
          <tr>
          	 <td>&nbsp;</td>
	           <td>
	               	   <custom:text name="newhash" property="shortvalue" />
	                   <a onclick="page_selectArea()"><custom:button type="3" label="L_Asterisk" imgsrc="flash.gif" border="0"/></a>
	                   <custom:hidden name="newhash" property="dictionaryids" />
	                   
	           </td>
	           <td><custom:text name="newhash" property="shortname" /></td>
          </tr>
          <%@ include file="/inc/SummaryAction.inc"%>
</table>

      </table>
      <table width="100%" cellspacing="0" cellpadding="0">
		 <tr>
			<td class="summary_top"></td>
		 </tr>      
          <tr>
                 <td colspan="8" class="td_right">
                   <a onclick="page_add();"><custom:button type="2" label="L_Add" imgsrc="add_btn.gif" border="0"/></a>
                   <a onclick="page_delete();"><custom:button type="2" label="L_Delete" imgsrc="delete_btn.gif" border="0"/></a>
                 </td>
		  </tr>
      </table>
</form>
</table>
</body>
</html>


